/**
 * Copyright (c) 2016-2019 人人开源 All rights reserved.
 * <p>
 * https://www.renren.io
 * <p>
 * 版权所有，侵权必究！
 */

package io.renren.modules.job.task;

import io.renren.modules.job.utils.messageUtil;
import io.renren.modules.sys.entity.SysUserEntity;
import io.renren.modules.sys.service.TiananService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;


@Component("SendMessage")
public class SendMessage {
    private Logger logger = LoggerFactory.getLogger(getClass());
    @Autowired
    private TiananService tiananService;

    public void run(String params) {


        List<SysUserEntity> list = tiananService.listreuser();
        List<SysUserEntity> lists = tiananService.listleauser();


        lists.forEach(e->{
            String content="[成都工业职业技术学院教代会提案系统]:您有"+e.getNum()+"条提案待处理";
            messageUtil.sendemil(
                    String.valueOf(e.getUsername()),
                    e.getMobile(),
                    null,
                    "成都工业职业技术学院教代会提案系统",
                    content
            );
        });


        list.forEach(e->{
            String content="[成都工业职业技术学院教代会提案系统]:您有"+e.getNum()+"条提案待处理";
            messageUtil.sendemil(
                    String.valueOf(e.getUsername()),
                    e.getMobile(),
                    null,
                    "成都工业职业技术学院教代会提案系统",
                    content
            );
        });

    }

}
